package freeCellBackend;

public class Card {
	//Card Constants
	//Suits
	public final int Spade = 0;
	public final int Heart = 1;
	public final int Club = 2;
	public final int Diamond = 3;
	
	//Values
	public final int Ace = 1;
	public final int Two = 2;
	public final int Three = 3;
	public final int Four = 4;
	public final int Five = 5;
	public final int Six = 6;
	public final int Seven = 7;
	public final int Eight = 8;
	public final int Nine = 9;
	public final int Ten = 10;
	public final int Jack = 11;
	public final int Queen = 12;
	public final int King = 13;
	
	//The two pieces of data for each card
	private int suite;
	private int value;
	private int index;
	
	public Card(int Suite, int Value, int Index) {
		this.value = Value;
		this.suite = Suite;
		this.index = Index;
	}
	
	public Card(int Index) {
		this.index = Index;
		this.suite = Index/13;
		this.value = (Index%13)+1;
	}
	
	public int getSuite() {
		return suite;
	}
	public int getValue() {
		return value;
	}
	public int getIndex() {
		return index;
	}
	public boolean equals(Card c) {
		if (this.suite == c.getSuite() && this.value == c.getValue()) {
			return true;
		}
		return false;
	}
	
	public String toString() {
		String temp = "";
		temp = temp + value;
		if(this.suite == 0)
			temp=temp+"S";
		else if(this.suite == 1)
			temp=temp+"H";
		else if(this.suite == 2)
			temp=temp+"C";
		else if(this.suite == 3)
			temp=temp+"D";
		return temp + " ";
	}
}
